const path = require('path')
const registerRouter = require('./backend/router')
const resolve = (url) => {
  return path.resolve(__dirname, url)
}
module.exports = {
  chainWebpack: config => {
    config.module
      .rule('images')
      .set('parser', {
        dataUrlCondition: 4 * 1024
      })
    // config.optimization.minimize(true);
    config.optimization.splitChunks({
      chunks: 'all'
    })
  },
  configureWebpack: {
    resolve: {
      alias: {
        '@': resolve('src'),
        '@css': resolve('src/assets/scss'),
        '@com': resolve('src/components')
      }
    }
  },
  productionSourceMap: false,
  devServer: {
    before(app) {
      registerRouter(app)
    }
  }
}
